﻿function fnIngresoSoloMayusculasDigitosYSimbolos() 
{
    key = window.event.keyCode;
    if ((key > 0x60) && (key < 0x7B))
        window.event.keyCode = key - 0x20;
}

function fnIngresoNumeroEnteroPositivo() {
    if (window.event.keyCode == 13)
        return;
    if (window.event.keyCode < 48 || window.event.keyCode > 57) {
        window.event.keyCode = 0;
    }
}

function fnIngresoNumeroDecimales(objName) {
    if (window.event.keyCode != 46 && (window.event.keyCode < 48 || window.event.keyCode > 57)) {
        window.event.keyCode = 0;
        return;
    }
    else {
        if (window.event.keyCode == 46 && objName.value.length == 0) {
            objName.value = '0';
            return;
        }
        else {
            var checkStr = objName;
            var punto = 0;
            for (i = 0; i < checkStr.value.length; i++) {
                if (checkStr.value.charAt(i) == '.') {
                    punto = punto + 1;
                }
            }
            var cadena = new String();
            cadena = objName.value.split('.');

            if (punto > 0) {
                if (cadena[1].length > 1)
                { window.event.keyCode = 0; }
                else {
                    if (punto > 0 && window.event.keyCode == 46)
                    { window.event.keyCode = 0; }
                }
            }
        }
    }
}